﻿@{
    ViewBag.Title = "Notify";
}
@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
}

<style type="text/css">
			body {
				background: #fff;
			}
			
			.Update-main {
				max-width: 900px;
				min-width: 500px;
				margin: 0 auto;
				height: auto;				
				position: relative;
			}
			
			.Update-main>h3 {
				margin-left: 20px;
                font-size: 20px;
			}
			
			#Update-tiem {
				margin-top: 20px;
				margin-left: 20px;
				color: #A7A7A7;
				font-size: 12px;
				line-height: 24px;
			}
			
			.Update-content {
				width: 100%;
				height: auto;
				height: 330px;
				overflow: auto;				
				position: relative;
			}
			
			.Update-content>h4 {
				margin-left: 30px;
			}
			
			.Update-box {
				margin: 0 10px 20px 10px;
			}
			.Update-title {
				color: orange;
				font-size: 20px;
				font-weight: bold;
				line-height: 25px;
				margin: 10px 0;
			}
			
			.box-content {
				color: #333333;
				font-size: 18px;
				line-height: 30px;
			}
			
			.Update-button {
				/*position: absolute;*/
				margin-bottom: 20px;
				margin-right: 50px;
				float: right;
			}
			
			.Update-but {
				width: 100px;
				height: 32px;
				line-height: 32px;
				text-align: center;
				margin: 0 10px;
				background: #fff;
				border: 1px solid #A7A7A7;
				border-radius: 10px;
				cursor: pointer;
				outline: none;
			}            
            .box-content p {
                margin-left:10px;
                margin-top:5px;
                margin-right:0px;
                margin-bottom:5px;
                color:#5e5e5e;
                font-size:16px;
            }
            h3 p {
                margin:0;
                padding:0;
                color:#3e3e3e;
            }
            .Update-tiem p {
                margin:0;
                padding:0;
            }
		</style>


<div class="Update-main">
    @{
      System.Data.DataTable dt = (@ViewBag.Data as System.Data.DataTable);
	<h3><p id="Title">@dt.Rows[0]["FMsg"].ToString()</p></h3>
	<span id="Update-tiem">@dt.Rows[0]["FCreateTime"].ToString()</span>
	<hr>
	<div class="Update-content">
		<h4>近期升级内容如下:</h4>
		<div class="Update-box">
			<p class="Update-title"></p>
			    <p class="box-content">
                
			    </p>
		</div>
	</div>
	<div class="Update-button">
		<input class="Update-but" id="prev" type="button" value="上一条" />
		<input class="Update-but" id="more" type="button" value="下一条" />
		<input class="Update-but" id="close" type="button" value="知道了" />
	</div>
    }
</div>

<input name="lasttime" class="mini-hidden"  value="@ViewBag.LastTime"/>
<input name="Content" class="mini-hidden"  value="@ViewBag.Content"/>
<input name="Jsonstr" class="mini-hidden"  value="@ViewBag.Json"/>
<script>
    var index = 0;
    mini.parse();

    function FormShown() {
    }

    $(function () {

        $("#prev").click(function () {
            if (index > 0) index--; else return;
            var data = mini.decode(mini.getbyName("Jsonstr").getValue());
            if (index > data.length) return;

            $(".box-content").html(decodeURIComponent(data[index].FContent));
            $("#Title").html(data[index].FMsg);
            $("#Update-tiem").html(dateFtt("yyyy-MM-dd hh:mm:ss", data[index].FCreateTime));
        });

        $("#more").click(function () {
            var data = mini.decode(mini.getbyName("Jsonstr").getValue());
            if (index+1 >= data.length) return;
            index++;            

            $(".box-content").html(decodeURIComponent(data[index].FContent));
            $("#Title").html(data[index].FMsg);
            $("#Update-tiem").html(dateFtt("yyyy-MM-dd hh:mm:ss", data[index].FCreateTime));
        });
        $("#close").click(function () {
            var json = '{"mSystemAppID":"' + parent.window.getSystemAppID()
                + '","LastTime":"' + mini.getbyName("lasttime").getValue() + '"}';
            $.post("UserReadInfo", {mjson: json}, function (data) {
            });
            CloseWindow();
        });
        $(".box-content").html(decodeURIComponent(mini.getbyName("Content").getValue()));
    });

    function getContent(id) {
        mini.open({
            url: "/UpdateInfo/UpdateHtml",
            title: "升级内容", width: 600, height: 600,
            onload: function (data) {
                var iframe = this.getIFrameEl();
                var data = { FItemID: id };
                iframe.contentWindow.SetInfoData(data);
            }
        });
    }

    function dateFtt(fmt, date) { //author: meizz   
        var o = {
            "M+": date.getMonth() + 1, //月份   
            "d+": date.getDate(), //日   
            "h+": date.getHours(), //小时   
            "m+": date.getMinutes(), //分   
            "s+": date.getSeconds(), //秒   
            "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
            "S": date.getMilliseconds() //毫秒   
        };
        if (/(y+)/.test(fmt))
            fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
            if (new RegExp("(" + k + ")").test(fmt))
                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
</script>
